package com.aviva.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSenderImpl;

@Configuration
public class MailSenderConfig {
	@Value(value="${mail.host}") String mailHost;
	@Value(value="${mail.port}") String mailPort;
	public MailSenderConfig() {}
	
	@Bean(name="mailSender")
	JavaMailSenderImpl getMailSender(){
		JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
		mailSender.setHost(mailHost);
		mailSender.setPort(Integer.parseInt(mailPort));
		return mailSender;
	}
}
